package cn.monkey.transport.core;

import java.util.function.Supplier;

public interface IdleExchange extends Exchange {
    Supplier<Long> timer();

    long maxIdleTimeMs();

    long lastIdleTimeMs();

    @Override
    default boolean isActive() {
        return this.timer().get() - this.lastIdleTimeMs() <= this.maxIdleTimeMs();
    }
}
